package constraint;

import java.util.ArrayList;
import java.util.List;

import common.MCore;

import expression.MIntExpr;
import expression.MIntVar;

public abstract class MCompare extends MConstraint {
	private MIntExpr[] parameters;

	public MCompare(MCore c, MIntExpr left, MIntExpr right) {
		super(c);
		parameters = new MIntExpr[2];
		parameters[0] = left;
		parameters[1] = right;
	}

	public MIntExpr[] getParameters() {
		return parameters;
	}
	
	public List<MIntVar> getVariables() {
		List<MIntVar> vars = new ArrayList<MIntVar>();
		
		vars.addAll(getParameters()[0].getVariables());
		for (MIntVar v: getParameters()[1].getVariables()) {
			if (!vars.contains(v)) {
				vars.add(v);
			}
		}
		
		return vars;
	}
}
